#include <sys/mman.h>

#if defined(__APPLE__)
/* Mac OS uses MAP_ANON insteadof MAP_ANONYMOUS */
#define MAP_ANONYMOUS MAP_ANON
#endif

void* AllocRWEMemory(size_t size) {
    void* p = mmap(0,size
        ,PROT_READ | PROT_WRITE | PROT_EXEC
        ,MAP_PRIVATE | MAP_ANONYMOUS
        ,-1,0);

    if (p == MAP_FAILED) return 0;
    return p;
}

void FreeRWEMemory(const void* ptr) {
    (void)ptr;
}
